'use strict'

const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
	// template:'./dist/index.html',
	filename: 'index.html',
	inject: 'body'
})

function resolve (dir) {
  return path.join(__dirname,  dir)
}

module.exports = {
	entry: {
		main: './src/index.js'
	},
	output: {
		filename: 'index.js',
		path: path.resolve(__dirname, 'dist')
	},
	module: {
	    rules: [{
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
        include: [
          resolve('src')],
        query: {
        	presets: ['es2015', 'react']
        }
      },{
	        test: /\.css$/,
	        use: ['style-loader', 'css-loader']
	    }, {
	        test: /\.(png|svg|jpg|gif|woff|woff2|eot|ttf|otf)$/,
	        use: ['file-loader']
	    }]
	},
	devtool: '#cheap-module-source-map',
	plugins: [HtmlWebpackPluginConfig]
}